//记录分盘
class ScorePanel{
    socre = 0 ;
    leve = 1; 
    scoreEle:HTMLElement;
    levelEle:HTMLElement;

    //限制等级
    maxLevel :number;

    //每多少分升一级
    upScore:number;

       //构造器
    constructor(maxLevel:number=10,upScore:number=10){
        this.scoreEle = document.getElementById("score")!;
        this.levelEle = document.getElementById("level")!
        this.maxLevel = maxLevel
        this.upScore = upScore
    }

    addScore(){
        this.scoreEle.innerHTML =   ++this.socre + '';
        //判断分数
        if(this.socre%this.upScore==0){
            this.levelUp()
        }
    }

    levelUp(){
        if(this.leve<this.maxLevel){
            this.levelEle.innerHTML =   ++this.leve + '';
        }
    }

}

export default  ScorePanel